package com.cc.service;

import com.cc.mapper.EbProductCategoryMapper;
import com.cc.model.EbProductCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2020-10-30 09:44
 */
@Service
public class ProductCategoryService {
    @Autowired
    private EbProductCategoryMapper ebProductCategoryMapper;
    /*
        Map ----大蛇皮袋
        map.put("big",bigs);
        map.put("small",smalls)
     */

    public Map<String, List<EbProductCategory>> findBigAndSmall(){
        //1.查询所有大类
        List<EbProductCategory> bigs = ebProductCategoryMapper.selectBigCategory();
//        System.out.println("所有大类："+bigs);
        //2.查询所有小类
        List<EbProductCategory> smalls = ebProductCategoryMapper.selectSmallCategory();
//        System.out.println("所有小类："+smalls);
        //3.放到map的大蛇皮袋
        Map<String, List<EbProductCategory>> categorysMap =
                new HashMap<>();
        //将大类和小类集合放入大蛇皮袋
        categorysMap.put("bigs",bigs);
        categorysMap.put("smalls",smalls);
        return categorysMap;

    }

}
